<?php

/**
 * Opis form.
 *
 * @package    dnevnik
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $
 */
class OpisForm extends BaseOpisForm
{
  public function configure()
  {
      $this->embedI18n(array('sr', 'hr', 'en'));
      $this->setWidget('sr', new sfExtraWidgetFormRichTextarea());
      $this->setWidget('hr', new sfExtraWidgetFormRichTextarea());
      $this->setWidget('en', new sfExtraWidgetFormRichTextarea());
      $this->widgetSchema->setLabel('sr', 'Srpski');
      $this->widgetSchema->setLabel('hr', 'Hrvatski');
      $this->widgetSchema->setLabel('en', 'Engleski');

      $v = new sfValidatorString();
      $v->setOption('required', false);
      $v->setMessage('required', '...');
      $this->setValidator('sr', $v);
      $this->setValidator('hr', $v);
      $this->setValidator('en', $v);

      $this->defaults['sr'] = $this->defaults['sr']['text'];
      $this->defaults['hr'] = $this->defaults['hr']['text'];
      $this->defaults['en'] = $this->defaults['en']['text'];
  }

  public function save($con = null)
  {
    $this->values['sr'] = array('text' => $this->values['sr']);
    $this->values['hr'] = array('text' => $this->values['hr']);
    $this->values['en'] = array('text' => $this->values['en']);

    return parent::save($con);
  }

}